package crp.extensions.scy.storage;

import com.qwlabs.cdi.Dispatchable;
import com.qwlabs.storage.s3.CustomS3Client;
import com.qwlabs.storage.s3.S3StorageEngine;
import crp.extensions.scy.SCY;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Objects;

public class SCYStorageEngine extends S3StorageEngine implements Dispatchable<String> {

    public SCYStorageEngine() {
        super(null);
    }

    public SCYStorageEngine(CustomS3Client s3Client) {
        super(s3Client);
    }

    public boolean exist(String bucket, String objectName) {
        return s3Client.exist(bucket, objectName);
    }

    @Override
    public boolean dispatchable(@Nullable String context) {
        return Objects.equals(SCY.ENV, context);
    }
}
